/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-08-08     admin       the first version
 */
#ifndef APPLICATIONS_SY_BC26_H_
#define APPLICATIONS_SY_BC26_H_
#ifdef __cplusplus
extern "c"{
#endif

typedef enum
{
    BC26_CMD_READY=1,
    BC26_CMD_IMEI,
    BC26_CMD_CSQ,
    BC26_CMD_TCP,
    BC26_CMD_MQTT

}BC26_RET_TYPE;
typedef enum
{
    BC26_RETERROR=-1,
    BC26_RETTIMEOUT=-2,
    BC26_RETOK=0,
    BC26_RETREADY=1

}BC26_RET;

typedef struct _bc20_info
{
    unsigned char csq[5];
    unsigned char imei[20];

}bc20_info_t;

typedef struct _bc26_state
{
    unsigned char bc26_rady;
    unsigned char net_connect;
    unsigned char mqtt_ready;
    unsigned char mqtt_connect;
    unsigned char mqtt_subtopic;
    unsigned char mqtt_pubtopic_ready;
    unsigned char mqtt_pubtopic;
    unsigned char tcp_connect;

}bc26_state_t;

typedef struct _bc26_rec_data
{
    unsigned char cmd_rec[64];
    unsigned int cmd_rec_size;

    unsigned char urc_rec[1300];
    unsigned int urc_rec_size;

}bc26_rec_t;

typedef struct _bc26_mqtt_publish
{
    unsigned char topic[16];
    unsigned char data[256];

}bc26_mqtt_publish_t;

int Bc26_Init();
char* Bc26_GetImei();
int Bc26_NetworkSate();
rt_size_t Bc26_SendCmd(unsigned char *buf);

BC26_RET Bc26_WaitForRet(unsigned char *dest,int dest_size,unsigned int time_out);

extern bc26_state_t bc26_state;

#ifdef __cplusplus
}
#endif
#endif /* APPLICATIONS_SY_BC26_H_ */
